import Vue from 'vue';
import Vuex from 'vuex';
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex);



const store = {
    plugins: [createPersistedState()], //本地持久化
    state: {
        phone: '',
        token: '',
        userId: '',
        islogin: false,

        addressname: '',
        addresstel: '',
        address: ''
    },
    mutations: {
        updateislogin(state, play) {
            return state.islogin = play
        },
        updatephone(state, play) {
            return state.phone = play
        },
        updatetoken(state, play) {
            return state.token = play
        },
        updateuserId(state, play) {
            return state.userId = play
        },
        updateaddressname(state, play) {
            return state.addressname = play
        },
        updateaddresstel(state, play) {
            return state.addresstel = play
        },
        updateaddress(state, play) {
            return state.address = play
        },

    },
    actions: {},//异步
}

export default new Vuex.Store(store);
export  {store}